package com.dog.basics.admin.controller.wishwash.admin;

import com.dog.basics.bean.vo.admin.wishwash.AdminFieldStatisticsVo;
import com.dog.basics.bean.vo.admin.wishwash.AdminMapStatisticsVo;
import com.dog.basics.common.util.R;
import com.dog.basics.service.wishwash.IndexControllerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @description: 首页统计
 * @author: He
 * @date: Created in 2021/8/3 17:50
 * @version: 1.0
 * @modified By:
 */
@RestController
@AllArgsConstructor
@RequestMapping("/admin/index")
@Api(value = "首页统计", tags = "首页统计")
public class AdminIndexController {

    private final IndexControllerService indexControllerService;

    /**
     * @功能描述: 地图统计
     * @author He
     * @date 2021/8/3
     */
    @ApiOperation(value = "地图统计", notes = "admin_index_map")
    @GetMapping("/map")
    @PreAuthorize("@pms.hasPermission('admin_index_map')")
    public R<AdminMapStatisticsVo> getMapStatistics() {
        return R.ok(indexControllerService.getMapStatistics());
    }

    /**
     * @功能描述: 场地信息统计
     * @author He
     * @date 2021/8/3
     */
    @ApiOperation(value = "场地信息统计", notes = "admin_index_field")
    @GetMapping("/field")
    @PreAuthorize("@pms.hasPermission('admin_index_field')")
    public R<List<AdminFieldStatisticsVo>> getFieldStatistics() {
        return R.ok(indexControllerService.getFieldStatistics());
    }
}
